package com.ztools.common.config.rabbitMq.config;

import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @Author: 一口香菜
 * @Date: 2023/3/24  12:36
 * @Version 1.0
 * 交换机配置类
 */
@Component
public class ExchangeConfig {

    /**
     * 交换机名称(topic交换机)
     */
    public static final String TOPIC_EXCHANGE = "seeTools_topic_exchange";

    /**
     * 死信交换机
     */
    public static final String DLX_EXCHANGE = "seeTools_dlx_exchange";

    /**
     * 1.topic交换机
     */
    @Bean("topicExchange")
    public TopicExchange bootExchange() {
        return ExchangeBuilder.topicExchange(TOPIC_EXCHANGE).durable(true).build();
    }

    /**
     * 2.死信交换机
     */
    @Bean("dlxExchange")
    public TopicExchange dlxExchange() {
        return ExchangeBuilder.topicExchange(DLX_EXCHANGE).durable(true).build();
    }

}
